/*!
 * Extensible 1.5.0
 * Copyright(c) 2010-2011 Extensible, LLC
 * licensing@ext.ensible.com
 * http://ext.ensible.com
 */

Ext.define('MyDesktop.Calendar', {
    extend: 'Ext.ux.desktop.Module',
    requires: [
        'Ext.Window',
        'Extensible.calendar.data.MemoryEventStore',
        'Extensible.calendar.CalendarPanel',
        'Extensible.example.calendar.data.Events'
    ],
    id: 'calendar-win',
    init: function () {
        this.launcher = {
            text: 'Calendar Window',
            iconCls: 'calendar',
            handler: this.createWindow,
            scope: this
        };
    },
    createWindow: function () {
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('calendar-win');
        if (!win) {
            win = desktop.createWindow({
                id: 'calendar-win',
                layout: 'fit',
                title: 'Calendar Window',
                width: 850,
                height: 700,
                animCollapse: false,
                border: false,
                items: {
                    xtype: 'extensible.calendarpanel',
                    eventStore: Ext.create('Extensible.calendar.data.MemoryEventStore', {
                        data: Ext.create('Extensible.example.calendar.data.Events')
                    })
                }
            });
        }
        win.show();
        return win;
    }
});

//Ext.ns('Extensible.example');
//Extensible.example.msg = function (title, format) {
//    if (!this.msgCt) {
//        this.msgCt = Ext.core.DomHelper.insertFirst(document.body, { id: 'msg-div' }, true);
//    }
//    this.msgCt.alignTo(document, 't-t');
//    var s = Ext.String.format.apply(String, Array.prototype.slice.call(arguments, 1));
//    var m = Ext.core.DomHelper.append(this.msgCt, { html: '<div class="msg"><h3>' + title + '</h3><p>' + s + '</p></div>' }, true);

//    m.slideIn('t').pause(3000).ghost('t', { remove: true });
//};